home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 32 / advsys.zip / ADVSYS.DOC < prev    next >
Text File  |  1987-05-03  |  31KB  |  1,189 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                       ADVSYS - An Adventure Writing System
  8.  
  9.                                   Version 1.2
  10.  
  11.                                  by David Betz
  12.                                 127 Taylor Road
  13.                              Peterborough, NH 03458
  14.                              (603) 924-6936 (home)
  15.  
  16.                                  July 14, 1986
  17.  
  18.                        Copyright (c) 1986, by David Betz
  19.                               All Rights Reserved
  20.         Permission is hereby granted for unrestricted non-commercial use
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.         ADVSYS            An Adventure Writing System             Page 2
  71.  
  72.  
  73.         INTRODUCTION
  74.  
  75.         ADVSYS is a special purpose programming language that was
  76.         specifically designed to be used to write computer text
  77.         adventure games.  It includes a facility for defining the kinds
  78.         of objects that are common in adventures.  Some objects
  79.         represent locations on the game map, some objects represent
  80.         things that the player can find while exploring the adventure
  81.         world, and some objects represent other characters that the
  82.         adventurer can encounter during his or her journeys.  The
  83.         adventure language also provides a facility to define actions.
  84.         Actions are short sections of code that determine what happens
  85.         in response to a command from the player.  These two concepts,
  86.         "objects" and "actions" form the basis for the adventure
  87.         language.
  88.  
  89.  
  90.         ACKNOWLEDGEMENTS
  91.  
  92.         Although I have written all of the code associated with this
  93.         adventure writing system, I must acknowledge the assistance of
  94.         one individual without whom this project would probably never
  95.         have reached completion.  That person is Gary McGath.  Gary was
  96.         interested in writing a commercial quality adventure game and I
  97.         convinced him to write it using my system (which was as yet
  98.         almost completely unspecified) instead of using a traditional
  99.         programming language.  The input that Gary provided during the
  100.         development of his game contributed significantly to the overall
  101.         design of the system.  I would like to thank Gary for that
  102.         contribution.
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.         ADVSYS            An Adventure Writing System             Page 3
  137.  
  138.  
  139.         USING THE SYSTEM TO WRITE AN ADVENTURE
  140.  
  141.         In order to write an adventure using this system, you need to
  142.         write an adventure description.  This is an ordinary ASCII text
  143.         file containing definitions for all of the objects and actions
  144.         in your adventure game.  This file is used as input to the
  145.         adventure compiler.  The compiler takes the adventure
  146.         description and compiles it into a set of data structures.
  147.  
  148.         In order to play an adventure written using this system, you
  149.         need the data structure file that was produced by the compiler
  150.         and the adventure interpreter program.  The interpreter uses the
  151.         information produced by the adventure compiler to allow a player
  152.         to play the adventure game.  Notice that it is not necessary for
  153.         the player to have access to the original adventure description
  154.         file.  All of the information that is necessary to play the
  155.         adventure game is contained within the data structure file that
  156.         is produced by the compiler.  This file is a binary file that
  157.         cannot be simply "listed" to reveal the internal workings of the
  158.         adventure.
  159.  
  160.         The adventure compiler is called ADVCOM and the interpreter is
  161.         called ADVINT.  These two programs in conjunction with this
  162.         documentation are all that is required to write and play
  163.         adventure games using this system.
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.         ADVSYS            An Adventure Writing System             Page 4
  203.  
  204.  
  205.         RUNNING THE COMPILER
  206.  
  207.         If you have created an adventure definition file called
  208.         "MYADV.ADV", you can compile it with the command:
  209.  
  210.                 A>advcom myadv
  211.  
  212.         Typing this command will invoke the adventure compiler and cause
  213.         it to compile the file named "MYADV.ADV".  The ".ADV" extension
  214.         is added to the file name by the compiler.  During the process
  215.         of compiling the file, many messages will be printed telling
  216.         about the progress of the compiler.  At the end of the
  217.         compilation process, the compiler prints a set of statistics
  218.         describing the resulting data structure file.  This file will be
  219.         called "MYADV.DAT".  It contains the data structures needed by
  220.         the adventure interpreter to allow a player to play the
  221.         adventure game.
  222.  
  223.         Note: The "A>" in the line above is the MS-DOS prompt and should
  224.         not be typed as part of the command.
  225.  
  226.  
  227.         RUNNING THE INTERPRETER
  228.  
  229.         Assuming that you have a compiled adventure data file called
  230.         "MYADV.DAT", you can play the adventure by typing the command:
  231.  
  232.                 A>advint myadv
  233.  
  234.         This command will start the adventure.  There will probably be
  235.         some text printed at this point describing the adventure and the
  236.         initial situation.  You will then be prompted to type a command.
  237.         The prompt is the colon character.  The format for commands is
  238.         described under the section about the parser.  After typing a
  239.         command, you will be told what happened as a result of your
  240.         command, your new situation will be described and you will begin
  241.         the loop again.
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.         ADVSYS            An Adventure Writing System             Page 5
  269.  
  270.  
  271.         ADVENTURE DESCRIPTION FILE FORMAT
  272.  
  273.             All adventure description files contain a collection of
  274.             statements.  These statements must be formed according to
  275.             the following rules:
  276.  
  277.  
  278.         The adventure definition statement:
  279.  
  280.             All adventure definitions should have an ADVENTURE
  281.             statement.  This statement gives the name of the adventure
  282.             and the version number of the definition file.  Each
  283.             adventure should have a unique name.  This name is used to
  284.             identify "saved position" files and insure that only files
  285.             that correspond to the current adventure are restored.  The
  286.             version number allows the author to have many versions of
  287.             the same adventure during development and guarantee that
  288.             "save" files from one version aren't restored into another
  289.             version.
  290.  
  291.               (ADVENTURE name version)
  292.  
  293.           Example:
  294.  
  295.               (ADVENTURE sample 1)
  296.  
  297.  
  298.         Vocabulary statements:
  299.  
  300.             These statements add words to the adventure vocabulary.
  301.  
  302.               (ADJECTIVE word*)
  303.               (PREPOSITION word*)
  304.               (CONJUNCTION word*)
  305.               (ARTICLE word*)
  306.               (SYNONYM word synonym*)
  307.  
  308.           Examples:
  309.  
  310.               (ADJECTIVE red blue)
  311.               (CONJUNCTION and)
  312.               (SYNONYM big large)
  313.  
  314.           Note:
  315.  
  316.               Words are also added to the vocabulary by the object
  317.               and action definitions using the NOUN, ADJECTIVE, VERB
  318.               and PREPOSITION statements.
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.         ADVSYS            An Adventure Writing System             Page 6
  335.  
  336.  
  337.         Constant definition statement:
  338.  
  339.               (DEFINE name value)
  340.  
  341.           Examples:
  342.  
  343.               (DEFINE what "I don't understand what you're saying!\n")
  344.               (DEFINE max-load 100)
  345.  
  346.  
  347.         Function definition statement:
  348.  
  349.               (DEFINE (function-name [arg-name]* [&aux tmp-name*]) expr*)
  350.  
  351.           Example:
  352.  
  353.               (DEFINE (factorial n)
  354.                 (IF (< n 2)
  355.                   1
  356.                   (* n (factorial (- n 1)))))
  357.  
  358.  
  359.         Variable definition statement:
  360.  
  361.               (VARIABLE variable-name*)
  362.  
  363.           Example:
  364.  
  365.               (VARIABLE score i j)
  366.  
  367.  
  368.         Property name definition statement:
  369.  
  370.               (PROPERTY property-name*)
  371.  
  372.           Example:
  373.  
  374.               (PROPERTY weight value)
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.         ADVSYS            An Adventure Writing System             Page 7
  401.  
  402.  
  403.         Comments:
  404.  
  405.             Comments begin with a semi-colon and end with the end of the
  406.             line.
  407.  
  408.           Example:
  409.  
  410.               ; this is a comment
  411.  
  412.  
  413.         Include files:
  414.  
  415.             Any line that begins with a "@" causes the inclusion of
  416.             another file.  The file name immediately follows the at-sign
  417.             and extends to the end of the line.  Only one level of
  418.             include is supported.
  419.  
  420.           Example:
  421.  
  422.               @basic.adv
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.         ADVSYS            An Adventure Writing System             Page 8
  467.  
  468.  
  469.         Handler definition statements:
  470.  
  471.               (INIT expr*)
  472.               (UPDATE expr*)
  473.               (BEFORE expr*)
  474.               (AFTER expr*)
  475.               (ERROR expr*)
  476.  
  477.           Example:
  478.  
  479.               (INIT
  480.                 (print "Welcome to the sample adventure!\n"))
  481.  
  482.  
  483.         Handlers:
  484.  
  485.             All activity within an adventure game is controlled by a
  486.             built-in handler loop.  Each of the handlers in the loop
  487.             contains code that is provided by the adventure author.  The
  488.             sequencing from handler to handler is provided by the
  489.             adventure system itself.
  490.  
  491.             The first handler that is called in an adventure game is the
  492.             INIT handler.  It prints some sort of introductory text and
  493.             initializes all global variables in order to start the
  494.             adventure game.
  495.  
  496.             After the INIT handler has completed, the normal loop is
  497.             entered.  It starts with the UPDATE handler.  The UPDATE
  498.             handler prepares for the player's next turn.  It should
  499.             describe the player's location if it has changed since the
  500.             last turn.  After the UPDATE handler completes, the parser
  501.             is called.  It prompts the player for a command, parses the
  502.             command, sets the built-in parser varaibles and exits.  Then
  503.             the BEFORE handler is called.  It is called before the
  504.             action associated with the command to allow the adventure
  505.             author to inspect the parser variables before proceeding to
  506.             the action itself.  After the BEFORE handler completes, the
  507.             action itself is called (or whatever action is stored in the
  508.             built-in variable $ACTION when the BEFORE handler
  509.             completes).  When the action completes, the AFTER handler is
  510.             called to give the author a chance to handle events that
  511.             happen only at the end of a successful turn.  The ERROR
  512.             handler is called when the parser detects an error.
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.         ADVSYS            An Adventure Writing System             Page 9
  533.  
  534.  
  535.         The handler loop:
  536.  
  537.             INIT
  538.              |
  539.              v
  540.             UPDATE<----------+
  541.              |               |
  542.              v               |
  543.             parse--->ERROR---+
  544.              |               |
  545.              v               |
  546.             BEFORE           |
  547.              |               |
  548.              v               |
  549.             action           |
  550.              |               |
  551.              v               |
  552.             AFTER------------+
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.         ADVSYS            An Adventure Writing System            Page 10
  599.  
  600.  
  601.         The parser:
  602.  
  603.             The parser handles all commands from the player.  It prompts
  604.             the player when it is ready for a new command.  The prompt
  605.             is the colon character.  When the player has typed a
  606.             command, the parser breaks the command into phrases.  The
  607.             parser recognizes the following command forms:
  608.  
  609.               [actor,] verb
  610.               [actor,] verb dobjects
  611.               [actor,] verb dobjects preposition iobject
  612.               [actor,] verb iobject dobjects
  613.  
  614.             Where:
  615.  
  616.               actor             ==> a noun phrase
  617.               verb              ==> the verb phrase (1 or 2 words)
  618.               dobjects          ==> dobject [conjunction dobject]*
  619.               dobject           ==> a noun phrase
  620.               preposition       ==> a preposition
  621.               iobject           ==> a noun phrase
  622.               noun phrase       ==> [article] [adjective]* noun
  623.  
  624.            Examples:
  625.  
  626.               Look
  627.               Take the red magic sword
  628.               Take the red sword and the blue bottle
  629.               Give the troll the red sword
  630.               Give the red sword to the troll
  631.               Troll, give me the sword
  632.  
  633.            Notes:
  634.  
  635.               Square brackets enclose optional phrases.  An asterisk
  636.               indicates zero or more of the preceeding element.
  637.  
  638.               The fourth form above is treated as if the player had
  639.               typed:
  640.  
  641.                 [actor,] verb dobject "to" iobject
  642.  
  643.             Once the parser has broken the command into phrases, it
  644.             assigns each noun phrase a number.  It stores the number of
  645.             the actor noun phrase in the built-in variable $ACTOR.  It
  646.             stores the first direct object noun phrase number in the
  647.             variable $DOBJECT.  It stores the number of direct objects
  648.             in the variable $NDOBJECTS.  It stores the indirect object
  649.             noun phrase number in the variable $IOBJECT.  If any of the
  650.             noun phrases is missing from the command, the corresponding
  651.             variable is set to NIL.  The parser saves the verb phrase
  652.             and preposition to use when determining which action to use
  653.             to handle the command.
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.         ADVSYS            An Adventure Writing System            Page 11
  665.  
  666.  
  667.         Action definition statement:
  668.  
  669.             Actions are used to handle player commands.  Each time the
  670.             parser finishes parsing a new command, it uses the verb
  671.             phrase and the preposition to locate an action to handle the
  672.             command.  Each action specifies a kind of template that must
  673.             match the command in order for the action to be called.  The
  674.             template consists of the words used in the verb phrase and
  675.             preposition and the existance of the actor, direct object
  676.             and indirect object noun phrases.  Once the parser finds an
  677.             action that matches the command, it stores the action in the
  678.             built-in variable $ACTION and exits.
  679.  
  680.               (ACTION action-name astat*)
  681.                   astat:
  682.                       (ACTOR [flag])
  683.                       (VERB verb*)
  684.                       (DIRECT-OBJECT [flag])
  685.                       (PREPOSITION word*)
  686.                       (INDIRECT-OBJECT [flag])
  687.                   flag:
  688.                       REQUIRED  must have the corresponding np
  689.                       OPTIONAL  may have the corresponding np
  690.                       FORBIDDEN must not have the corresponding np
  691.                   verb:
  692.                       word
  693.                       (word word)
  694.  
  695.           Example:
  696.  
  697.               (ACTION take
  698.                 (VERB take (pick up))
  699.                 (DIRECT-OBJECT)
  700.                 (CODE
  701.                   (print "You can't take the ")
  702.                   (print-noun $dobject)
  703.                   (print "!\n")))
  704.  
  705.             If the ACTOR, DIRECT-OBJECT or INDIRECT-OBJECT statements
  706.             are left out entirely, the settings of the corresponding
  707.             flags are taken from the action default definitions.  If
  708.             there is no action default definition, the value FORBIDDEN
  709.             is assumed.  If any of these statements is present, but no
  710.             flag is specified, it is treated as if the flag REQUIRED was
  711.             specified.
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.         ADVSYS            An Adventure Writing System            Page 12
  731.  
  732.  
  733.         Action default definition statement:
  734.  
  735.             This statement defines default values for the ACTOR, DIRECT-
  736.             OBJECT and INDIRECT-OBJECT flags.
  737.  
  738.               (DEFAULT dstat*)
  739.                   dstat:
  740.                       (ACTOR [flag])
  741.                       (DIRECT-OBJECT [flag])
  742.                       (INDIRECT-OBJECT [flag])
  743.                   flag:
  744.                       REQUIRED
  745.                       OPTIONAL
  746.                       FORBIDDEN
  747.  
  748.           Example:
  749.  
  750.               (DEFAULT
  751.                 (ACTOR OPTIONAL))
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.         ADVSYS            An Adventure Writing System            Page 13
  797.  
  798.  
  799.         Object definition statements:
  800.  
  801.             The object definition statements are used to define
  802.             individual objects and classes of objects.  The most basic
  803.             way of defining an object is using the (OBJECT ...)
  804.             statement.  This defines an object which has no parent
  805.             class.
  806.  
  807.             It is also possible to create a class of objects that share
  808.             information.  A class is defined just like a normal object.
  809.             It is given nouns, adjectives and properties.  In addition,
  810.             a class may have class properties.  These are properties
  811.             that are shared amongst all instances of the class.  In
  812.             order to create an instance of a class, the (class-name ...)
  813.             form is used.  This creates an instance of the named class.
  814.             An instance will inherit all nouns and adjectives from its
  815.             parent class.  It will also inherit all class properties
  816.             defined in the parent (and its parents).  Any normal
  817.             properties defined in the parent class will be copied to the
  818.             new object.  The copies will have the same values that the
  819.             parent has, but it is possible for the instance to have
  820.             property definitions that override these values.  Instances
  821.             may also have additional nouns, adjectives and properties.
  822.  
  823.               (OBJECT object-name ostat*)
  824.               (class-name object-name ostat*)
  825.                   ostat:
  826.                       (NOUN word*)
  827.                       (ADJECTIVE word*)
  828.                       (PROPERTY [property-name value]*)
  829.                       (CLASS-PROPERTY [property-name value]*)
  830.                       (METHOD (selector [arg-name]* [&aux tmp-name*])
  831.                           expr*)
  832.                   class-name:
  833.                       the name of a previously defined object
  834.  
  835.           Examples:
  836.  
  837.               (OBJECT sword
  838.                 (NOUN sword weapon)
  839.                 (CLASS-PROPERTY
  840.                   is-weapon T)
  841.                 (PROPERTY
  842.                   weight 10
  843.                   value 5
  844.                   damage 20))
  845.  
  846.               (sword red-sword
  847.                 (ADJECTIVE red)
  848.                 (PROPERTY
  849.                   damage 25))
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.         ADVSYS            An Adventure Writing System            Page 14
  863.  
  864.  
  865.         Expressions:
  866.  
  867.               (+ expr expr)     add
  868.               (- expr expr)     subtract
  869.               (* expr expr)     multiply
  870.               (/ expr expr)     divide
  871.               (% expr expr)     remainder
  872.  
  873.               (& expr expr)     bit-wise and
  874.               (| expr expr)     bit-wise or
  875.               (~ expr)          bit-wise complement
  876.  
  877.             These arithmetic functions operate on integers.  As it turns
  878.             out, every data type in the system is represented by an
  879.             integer, so these functions will work with any type of
  880.             arguments.  They are probably only useful with integers,
  881.             however.
  882.  
  883.               (RANDOMIZE)       reset the random number generator
  884.               (RAND expr)       generate a random number
  885.  
  886.             These functions enable the generation of pseudo-random
  887.             numbers.  The (RAND n) function takes a single argument and
  888.             generates a random number between zero and n-1.  (RANDOMIZE)
  889.             resets the seed used by the random number function so that
  890.             each invocation of a program results in a new sequence of
  891.             random numbers.
  892.  
  893.               (AND expr*)       logical and (short circuits)
  894.               (OR expr*)        logical or (short circuits)
  895.               (NOT expr)        logical not
  896.  
  897.             These functions operate on logical values.  In this system,
  898.             any value that is not equal to NIL (or zero) is considered
  899.             true.  NIL and zero are considered false.  AND and OR
  900.             evaluate their arguments from left to right and stop as soon
  901.             as the value of the entire expression can be determined.  In
  902.             other words, AND stops when it encounters a false value, OR
  903.             stops when it encounters a true value.
  904.  
  905.               (< expr expr)     less than
  906.               (= expr expr)     equal to
  907.               (> expr expr)     greater than
  908.  
  909.             These functions compare integers.  They cannot be used to
  910.             compare strings.
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.         ADVSYS            An Adventure Writing System            Page 15
  929.  
  930.  
  931.               (GETP obj property-name)          get the value of a property
  932.               (SETP obj property-name value)    set the value of a property
  933.  
  934.             These functions manipulate object properties.  They are used
  935.             to find the value of a property or to set the value of a
  936.             property.  They will also find and set the values of
  937.             inherited properties.  If GETP is used to find the value of
  938.             a property that doesn't exist for the specified object, NIL
  939.             is returned.  If SETP is used to set the value of a property
  940.             that doesn't exist, the operation is ignored.
  941.  
  942.               (CLASS obj)
  943.  
  944.             This function returns the class of an object.  If the object
  945.             was defined with an (OBJECT ...) statement, NIL will be
  946.             returned.  If the object was defined with the (class-name
  947.             ...) statement, the class object will be returned.
  948.  
  949.               (MATCH obj noun-phrase-number)
  950.  
  951.             This function matches an object with a noun phrase.  An
  952.             object matches a noun phrase if it includes all of the
  953.             adjectives specified in the noun phrase and also includes
  954.             the noun mentioned.  Both nouns and adjectives can be
  955.             inherited.
  956.  
  957.               (YES-OR-NO)       get a yes or no answer from the player
  958.  
  959.             This function waits for the player to type a line.  If the
  960.             line begins with a 'Y' or a 'y', the function returns T.  If
  961.             the line begins with anything else, the function returns
  962.             NIL.
  963.  
  964.               (PRINT expr)                      print a string
  965.               (PRINT-NUMBER expr)               print a number
  966.               (PRINT-NOUN noun-phrase-number)   print a noun phrase
  967.               (TERPRI)                          terminate the print line
  968.  
  969.             These functions perform various sorts of output.  PRINT
  970.             prints strings, PRINT-NUMBER prints numbers and PRINT-NOUN
  971.             prints a noun phrase.
  972.  
  973.               (FINISH)          exit and continue with the AFTER handler
  974.               (CHAIN)           exit and continue with the next handler
  975.               (ABORT)           exit and continue with the UPDATE handler
  976.               (RESTART)         exit and restart the current game
  977.               (EXIT)            exit to the operating system
  978.  
  979.             These functions cause the immediate termination of the
  980.             current handler.  FINISH causes execution to proceed with
  981.             the AFTER handler, CHAIN causes execution to proceed with
  982.             the next handler in the normal sequence, ABORT causes
  983.             execution to proceed with the UPDATE handler (effectively
  984.             aborting the current turn), RESTART restores the game to its
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.         ADVSYS            An Adventure Writing System            Page 16
  995.  
  996.  
  997.             original state and starts over with the INIT handler and
  998.             EXIT causes an immediate exit back to the operating system.
  999.  
  1000.               (SAVE)            save the current game position
  1001.               (RESTORE)         restore a saved game position
  1002.  
  1003.             These functions allow the player to save and restore
  1004.             positions in the game.  They prompt the player for a file
  1005.             name and either read a saved game position from the file or
  1006.             write the current game position to the file.
  1007.  
  1008.               (function-name expr*)
  1009.  
  1010.             This expression invokes a user defined function.  There
  1011.             should be one expression for each of the formal arguments of
  1012.             the user function.  The value of the expression is the value
  1013.             of the last expression in the body of the user function or
  1014.             the value passed to a RETURN statement within the function.
  1015.  
  1016.               (SEND object selector [expr]*)
  1017.  
  1018.             This expression sends a message to an object.  The "object"
  1019.             expression should evaluate to an object.  The selector
  1020.             should match a method selector for that object or one of its
  1021.             super-classes.  The matching method is invoked with the
  1022.             specified expressions as arguments.  Also, the implied
  1023.             argument SELF will refer to the object receiving the
  1024.             message.
  1025.  
  1026.               (SEND-SUPER selector [expr]*)
  1027.  
  1028.             This expression sends a message to the super-class of the
  1029.             current object.  It can only be used within a method and it
  1030.             will cause the message to be passed up the class heirarchy
  1031.             to the super-class of the object refered to by SELF.
  1032.  
  1033.               (SETQ variable value)
  1034.  
  1035.             This expression sets the value of a user variable.
  1036.  
  1037.               (COND [(test expr*)]*)            execute conditionally
  1038.               (IF test then-expr [else-expr])   traditional if-then-else
  1039.               (WHILE test expr*)                conditional iteration
  1040.               (PROGN expr*)                     block construct
  1041.               (RETURN [expr])                   return from a function
  1042.  
  1043.             These statements are control constructs.
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.         ADVSYS            An Adventure Writing System            Page 17
  1061.  
  1062.  
  1063.         Primary expressions:
  1064.  
  1065.             integer             (digits preceeded by an optional sign)
  1066.             string              (characters enclosed in double quotes)
  1067.             action-name         (an action name)
  1068.             object-name         (an object or class name)
  1069.             property-name       (a property name)
  1070.             constant-name       (a defined constant or function)
  1071.             variable-name       (a variable name)
  1072.  
  1073.             Since an adventure description contains a large quantity of
  1074.             running text, the format for specifying string constants is
  1075.             somewhat extended from normal programming languages.  In
  1076.             this system, a string is enclosed in double quotes.  If the
  1077.             end of line occurs before the closing quote within a string,
  1078.             it is treated as if it were a space.  Any number of
  1079.             consecutive spaces is collapsed into a single space.  Also,
  1080.             the character pair "\n" is used to represent the "end of
  1081.             line" character, the pair "\t" is used to represent the tab
  1082.             character and the pair "\\" is used to represent the
  1083.             backslash character.
  1084.  
  1085.           Examples:
  1086.  
  1087.                 "This is a string.\n"
  1088.                 "This
  1089.                  is
  1090.                  a
  1091.                  string.\n"
  1092.  
  1093.             Both of the examples above represent the same string.
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.         ADVSYS            An Adventure Writing System            Page 18
  1127.  
  1128.  
  1129.         Definitions of symbols used above:
  1130.  
  1131.             expr                an expression
  1132.             value               an expression
  1133.             test                an expression (NIL means false, anything else is true)
  1134.             then-expr           an expression
  1135.             else-expr           an expression
  1136.             obj                 an expression that evaluates to an object
  1137.             property-name       an expression that evaluates to a property name
  1138.             noun-phrase-number  an expression that evaluates to a noun phrase number
  1139.             variable            a variable name
  1140.             T                   true
  1141.             NIL                 false
  1142.  
  1143.  
  1144.         Built-in variables set by the parser:
  1145.  
  1146.             $ACTOR              (actor noun phrase number)
  1147.             $ACTION             (action)
  1148.             $DOBJECT            (first direct object noun phrase number)
  1149.             $NDOBJECTS          (number of direct object noun phrases)
  1150.             $IOBJECT            (indirect object noun phrase number)
  1151.  
  1152.  
  1153.         Other built-in variables:
  1154.  
  1155.             $OCOUNT             (total number of objects in the system)
  1156.  
  1157.  
  1158.         CURRENT COMPILER LIMITS
  1159.  
  1160.             500         words
  1161.             500         objects
  1162.             20          properties per object
  1163.             200         actions or functions
  1164.             16384       bytes of code
  1165.             16384       bytes of data
  1166.             262144      bytes of text
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.